package com.sky.sentinel.producer.service.impl;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.alibaba.csp.sentinel.slots.block.BlockException;
import com.sky.sentinel.producer.service.IDubboSentinelService;
import org.apache.dubbo.config.annotation.Service;

@Service
public class DubboSentinelServiceImpl implements IDubboSentinelService {

    @Override
    @SentinelResource(value = "dubboSentinel", blockHandler="sayHelloExceptionHandler")
    public String testDubboSentinel(String name) {
        return name + ", hello, testDubboSentinel";
    }


    public String sayHelloExceptionHandler(String name, BlockException ex){
        return "访问过快，限流降级, 请稍后重试!";
    }
}
